﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace Nirvana
{
    public sealed class FootprintManager : Singleton<FootprintManager>
    {
        private Dictionary<Material, FootprintMesh> footmeshDic = new Dictionary<Material, FootprintMesh>();
        public  void AddFootprint(Vector3 pos, Vector3 fwd, Vector3 rht, Footprint footprint)
        {
            Material mat = footprint.Material;
            FootprintMesh mesh;
            if(!this.footmeshDic.TryGetValue(mat,out mesh))
            {
                var obj = new GameObject("Footprint: " + mat.name);
                mesh = obj.AddComponent<FootprintMesh>();
                mesh.SetMaterial(64, mat);
                footmeshDic.Add(mat, mesh);
            }
            mesh.CreatMesh(pos, fwd, rht, footprint);
        }

    }
}

